// pages/notic/notic.js
const utils = require("../../utils/util.js")
Page({
  data: {
    title: '',
    notice: ''
  },
  sendNotice () {
    utils.getData('addNotify', { notifyTitle: this.data.title, notifyContent: this.data.notice},"POST")
    .then(res =>{
      console.log(res)
      if(res.data.success){
        wx.reLaunch({
          url: '../notify/notify'
        })
      }else{
        wx.showToast({
          title: "程序内部错误，请稍后再试",
          icon: '',
          duration: 2000
        })
      }
      
    })
  },
  getTitle: function (e) {
    this.setData({
      title: e.detail.value
    })
  },
  getNotice: function (e) {
    this.setData({
      notice: e.detail.value
    })
  }
})